function addUser() {
    var add = new Vue({
        el: "#form",
        data: {
            user:{
                username:"",
                sex:"",
                tellphone:"",
                registtime:"",
                type:"",
                consume:"",
                haircut:"",
                perm:"",
                wash_protect:"",
                hairroot:"",
                colour:"",
                wash:"",
                black:"",
                invest:"",
                remarks:"",
            },
        },
        methods: {
            add: function () {
                var username = document.getElementById("customerName").value;
                this.user.username = username;

                var man = document.getElementById("man");
                if(man.checked){
                    this.user.sex = man.value;
                }else{
                    this.user.sex = "女";
                }

                var tellphone = document.getElementById("phoneNumber").value;
                this.user.tellphone = tellphone;

                var project = document.getElementById("project").value;
                this.user.type = project;

                var Consumption = document.getElementById("Consumption").value;
                this.user.consume = Consumption;

                var cutnum = document.getElementById("cutnum").value;
                this.user.haircut = cutnum;

                var permnum = document.getElementById("permnum").value;
                this.user.perm = permnum;

                var nusenum = document.getElementById("nusenum").value;
                this.user.wash_protect = nusenum;

                var rootnum = document.getElementById("rootnum").value;
                this.user.hairroot = rootnum;

                var dyenum = document.getElementById("dyenum").value;
                this.user.colour = dyenum;

                var washnum = document.getElementById("washnum").value;
                this.user.wash = washnum;

                var blacknum = document.getElementById("blacknum").value;
                this.user.black = blacknum;

                var amount = document.getElementById("amount").value;
                this.user.invest = amount;

                var notes = document.getElementById("notes").value;
                this.user.remarks = notes;

                const reg1 =/^1([358][0-9]|4[579]|66|7[0135678]|9[89])[0-9]{8}$/;

                if(username === ""){
                    alert("请输入姓名！");
                }else if(!reg1.test(tellphone)){
                    alert("请输入正确的手机号码！");
                }else if(project === ""){
                    alert("请选择会员卡类型！");
                }else if(Consumption === ""){
                    alert("请输入消费金额！");
                }else if(amount === ""){
                    alert("请输入充值卡金！");
                }else{
                    var flag = confirm("确认提交?");
                    if (flag) {
                        axios.post("http://localhost:8081/user/add", this.user).then(res => {
                            alert(res.data.msg);
                            if(res.data.state){
                                location.reload();
                            }


                        })
                    }
                }
            }
        }
    });
    add.add();
}